import type { Pagination } from "./pagination";
import { ArticleTag } from "./tag";
export class Article {
  id: string;
  //标题
  title: string;
  //文章摘要
  summary: string;
  //所属分类名
  categoryName: string;
  //缩略图
  thumbnail: string;
  //访问量
  viewCount?: number;
  star?: number;
  codeTheme?: string;
  updateTime?: string;
  createTime?: string;
  commentCount?: number;
  tagList?: Array<ArticleTag>;
  createBy?: string;
  constructor() {
    this.id = "";
    this.title = "";
    this.summary = "";
    this.categoryName = "";
    this.thumbnail = "";
    this.viewCount = 0;
    this.codeTheme = "";
    this.updateTime = "";
    this.createTime = "";
    this.star = 0;
    this.commentCount = 0;
    this.createBy = "";
    this.tagList = [];
  }
}
// 搜索表单
export interface SearchForm {
  title?: string;
  categoryId?: string;
  isComment?: string;
  isTop?: string;
}
// 文章列表
export type ArticleList = Array<Article>;
// 分页查询文章
export type QueryArticleParam = Omit<Pagination, "total"> & SearchForm;
// 文章详情
export class ArticleDetail extends Article {
  content?: string;
  updateByName?: string;
  createByName?: string;
  isComment?: string;
}
